package com.hqyj.onlineExamination.modules.exam.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.hqyj.onlineExamination.modules.common.entity.SearchBean;
import com.hqyj.onlineExamination.modules.exam.dao.CorrectDao;
import com.hqyj.onlineExamination.modules.exam.entity.Achievement;
import com.hqyj.onlineExamination.modules.exam.entity.Question;
import com.hqyj.onlineExamination.modules.exam.service.CorrectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.Optional;

/**
 * @author yun
 * @date 2021-6-10 15:10
 */
@Service
public class CorrectImpl implements CorrectService {

    @Autowired
    private CorrectDao correctDao;

    @Override
    public PageInfo<Achievement> selectAllCorrect(SearchBean searchBean) {
        searchBean.initSearchBean();
        PageHelper.startPage(searchBean.getCurrentPage(),searchBean.getPageSize());
        return new PageInfo<Achievement>(Optional.ofNullable(correctDao.selectAlCorrect(searchBean)).
                orElse(Collections.emptyList()));
    }
}
